package com.guchenbo.schedule;

import jakarta.annotation.Resource;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.quartz.QuartzJobBean;

/**
 * @author guchenbo
 */
public class DemoQuartzJob extends QuartzJobBean {
    protected static final Logger log = LoggerFactory.getLogger(DemoQuartzJob.class);

    @Resource
    protected DemoService demoService;

    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        String str = demoService.hello();
        String jobKey = context.getJobDetail().getKey().getName();
        log.info("quartz run {} result: {}", jobKey, str);
    }
}
